<?php
namespace Syrius\Validator;
/**
 * Date: 19/09/11
 * Time: 7.35
 * @package     Validator
 * @author      Domenico Biancardi <domenico.biancardi@gmail.com>
 * @link        http://code.google.com/p/syrius/
 */

class MatchValidator extends Validator {

    private $_match;

    public function __construct($value, $match, $message = "") {
        $this->_match = $match;
        $this->setValue($value);
        $this->setMessage($message);
    }

    /**
     * Indica se il controllo è valido o meno
     * @param value
     * @return bool
     */
    public function isValid() {
        if (preg_match($this->_match, $this->_getValue())) {
            return true;
        }
        return false;
    }
}
